package com.anos.smsfun.services;

import com.anos.smsfun.R;
import com.anos.smsfun.model.MessageItem;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class smsDeliveredReceiver extends BroadcastReceiver {

	private MessageItem msgItem;

	public smsDeliveredReceiver(MessageItem msg) {
		this.msgItem = msg;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		try {
			switch (getResultCode()) {
			case Activity.RESULT_OK:
				Toast.makeText(
						context.getApplicationContext(),
						context.getApplicationContext().getString(
								R.string.toast_SMS_delivered)
								+ " [" + msgItem.getAddress() + "]",
						Toast.LENGTH_SHORT).show();
				break;
			case Activity.RESULT_CANCELED:
				Toast.makeText(context.getApplicationContext(),
						"SMS not delivered [" + msgItem.getAddress() + "]",
						Toast.LENGTH_SHORT).show();
				break;
			}

		} catch (Exception e) {
		}
	}

}